package com.example.translationapp.activity;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.translationapp.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by liuzhao.futrue on 2018/9/15.
 */

public class ListActivity extends AppCompatActivity {

    @BindView(R.id.lv)
    ListView lv;
    private SharedPreferences preferences;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listactivity);
        ButterKnife.bind(this);
        preferences = getSharedPreferences("trans", Context.MODE_PRIVATE);
        String old = preferences.getString("translations", "");
        String[] data = old.split("\\,");
        ArrayAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, data);
        lv.setAdapter(adapter);
    }
}
